package 力扣日常刷题.木22一月.第12天0120;

/**
 * @author 帅小伙
 * @date 2022/1/20
 * @description
 */
public class Demo36动态规划中等整数拆分 {



    public int integerBreak(int n) {
        if(n <= 3)return n-1;
        int r = n % 3;
        int k = n/3;
        if(r == 0)return (int)Math.pow(3,k);
        else if(r == 2) return 2* (int)Math.pow(3,k);
        else return 2*2*(int)Math.pow(3,k-1);
    }

}
